﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows.Forms;
using PluginInterface;
using Buccontrols;
using Buccaneer;

namespace PluginTry
{
    public class Plugin : IPlugin
    {
        public static string currentPath;
        public static FormTry MainForm;

        #region IPlugin Members

        static IPluginHost myPluginHost;
        Dictionary<string, PluginAction> menuActions = new Dictionary<string, PluginAction>();
        Dictionary<string, PluginAction> actionFuncs = new Dictionary<string, PluginAction>();
        string myPluginName = "PluginTry";
        string myPluginAuthor = "Adriaan Dekker";
        string myPluginDescription = "The first plugintry to be used with Buccaneer";
        string myPluginVersion = "1.0.3";

        public void Initialize()
        {
            // !IMPORTANT! add certain PluginActions to the menuActions property of this plugin
            this.menuActions.Clear();
            this.menuActions.Add("close", new CloseAction(this.MainInterface));
            this.menuActions.Add("navigate", new NavigateAction());
        }

        public void Activate()
        {

        }

        public void Dispose()
        {
            // TODO:  Add ctlMain.Dispose implementation
        }

        public string Path
        {
            get { return currentPath; }
            set { currentPath = value; }
        }

        public string Description
        {
            get
            {
                // TODO:  Add ctlMain.Description getter implementation
                return myPluginDescription;
            }
        }

        public string Author
        {
            get
            {
                // TODO:  Add ctlMain.Author getter implementation
                return myPluginAuthor;
            }
        }

        public IPluginHost Host
        {
            get
            {
                // TODO:  Add ctlMain.Host getter implementation
                return myPluginHost;
            }
            set
            {
                myPluginHost = value;
            }
        }

        public PluginForm MainInterface
        {
            get
            {
                if (MainForm == null)
                {
                    MainForm = new FormTry();
                }
                // TODO:  Add ctlMain.MainInterface getter implementation
                return MainForm;
            }
        }

        public PluginDaddy Daddy
        {
            get
            {
                return this.MainInterface.Daddy as PluginDaddy;
            }
            set
            {
                this.MainInterface.Daddy = value;
            }
        }

        public Dictionary<string, PluginAction> MenuActions
        {
            get
            {
                return this.menuActions;
            }
            set
            {
                this.menuActions = value;
            }
        }

        public string Version
        {
            get
            {
                // TODO:  Add ctlMain.Version getter implementation
                return myPluginVersion;
            }
        }

        public string Name
        {
            get { return myPluginName; }
            set { return; }
        }

        public Dictionary<string, PluginAction> ActionFunctions
        {
            get { return this.actionFuncs; }
        }

        #endregion
    }
}
